package com.tanhua.houtai.controller;



import com.tanhua.common.utils.NoAuthorization;
import com.tanhua.houtai.pojo.Logs;
import com.tanhua.houtai.service.LogsService;
import com.tanhua.houtai.vo.PageResult1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/manage/logs")
public class LogsController {

    @Autowired
    private LogsService logsService;


    @GetMapping("/count")
    @NoAuthorization
    public PageResult1 getCount(@RequestParam("page")Integer page,
                                @RequestParam("pagesize")Integer pageSize,
                                @RequestParam("operator")String name,
                                @RequestParam("content")String content,
                                @RequestParam("startTime")String startTime,
                                @RequestParam("endTime")String endTime){
        return this.logsService.getLogs(page,pageSize,name,content,startTime,endTime);
    }

    /**
     * 根据日志的id查询单条日志的详情
     * @param id   查询日志的id
     * @return
     */
    @GetMapping("/page")
    public Logs logPage(@RequestParam(value = "logId") Integer id){
        return this.logsService.queryLogpage(id);
    }

}
